package com.bestcem.xm.om.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 套餐版本
 *
 * @author wangyunyun <yunyun.wang@idiaoyan.com>
 * @version v1.0
 * @date 2022/3/10 17:15
 */
@Getter
@AllArgsConstructor
public enum PackageCategoryEnum {

    /**
     * 模块
     */
    MODULE(0, "模块'"),
    /**
     * 子模块
     */
    SUBMODULE(1, "子模块"),
    /**
     * 功能
     */
    DOMAIN(2, "功能"),
    ;

    private final Integer index;

    private final String name;

    public static PackageCategoryEnum getByType(Integer index) {
        if (index != null) {
            for (PackageCategoryEnum value : values()) {
                if (value.getIndex().equals(index)) {
                    return value;
                }
            }
        }
        return null;
    }
}
